const signFuncReg = /.*\(.*\)/
const matchSignFuncName = (text) => {
    return signFuncReg.test(text)
}

const eventNameReg = /.*/
const matchEventName = (text) => {
    return text.toLowerCase().indexOf("0x") !== 0 && !matchSignFuncName(text)
}
const getSignFuncArrfromObj = (obj) => {
    return Object.keys(obj).filter(v => matchSignFuncName(v))
}
const getFuncParameterArr = (methodSign) => {
    let matchFuncSign = /.*\((.*,)?(.*)?\)/
    let parameterMath = methodSign.match(matchFuncSign)
    let parameterArr = []
    // console.log("match:", parameterMath)

    if (parameterMath[1]) {
        parameterArr = parameterMath[1].split(",").filter(v => v).map(v => v.trim())
    }
    if (parameterMath[2]) {
        parameterArr.push(parameterMath[2])
    }
    return parameterArr;
}

export {
    getFuncParameterArr,
    matchSignFuncName,
    getSignFuncArrfromObj,
    matchEventName,
}